﻿using UnityEngine;
using System.Collections;

public class EventMaterial:EventTweenBase{
	public Material m_Target;
	public ColorEvent TargetColor;
	public string TargetColorName = "";
	public void Start(){
		if (m_Target == null)
			GameObject.Destroy (this);
		if (m_PlayStart)
			UpdateColor (0);
	}
	protected override void UpdateEvent(){
		UpdateColor (EventTime);
	}
	public void UpdateColor(float time){
		if (TargetColorName == "")
			m_Target.color = TargetColor.LerpAplah (easyType, time);
		else {
			m_Target.SetColor (TargetColorName, TargetColor.LerpAplah (easyType, time));
		}
	}
}
